/*
package cn.itcast.test;

import cn.itcast.utils.QiniuUtils;
import com.google.gson.Gson;
import com.qiniu.common.QiniuException;
import com.qiniu.common.Zone;
import com.qiniu.http.Response;
import com.qiniu.storage.BucketManager;
import com.qiniu.storage.Configuration;
import com.qiniu.storage.UploadManager;
import com.qiniu.storage.model.DefaultPutRet;
import com.qiniu.util.Auth;
import org.junit.Test;

//七牛云测试
public class Demo {

    */
/**
     * 上传图片
     *//*

    @Test
    public void test() {
        //构造一个带指定 Region 对象的配置类
        Configuration cfg = new Configuration(Zone.zone0());
        //...其他参数参考类注释
        UploadManager uploadManager = new UploadManager(cfg);
        //...生成上传凭证，然后准备上传
        String accessKey = "_5dEPwssysc_i7y7hnwAn60vHiGDsPyKNgMl_4Fk";
        String secretKey = "X3Xx3Ob-jE3siPjC8YOQWPYLorxuThHO3EYLuJN_";
        String bucket = "yanghuatestdata";
        //如果是Windows情况下，格式是 D:\\qiniu\\test.png
        String localFilePath = "E:\\传智健康\\传智健康\\day04\\素材\\图片资源\\e373b2eb-0e50-4e95-a09b-03f2c1ee1d351.jpg";
        //默认不指定key的情况下，以文件内容的hash值作为文件名
        String key = "e373b2eb-0e50-4e95-a09b-03f2c1ee1d351.jpg";
        Auth auth = Auth.create(accessKey, secretKey);
        String upToken = auth.uploadToken(bucket);
        try {
            Response response = uploadManager.put(localFilePath, key, upToken);
            //解析上传成功的结果
            DefaultPutRet putRet = new Gson().fromJson(response.bodyString(), DefaultPutRet.class);
            System.out.println(putRet.key);
            System.out.println(putRet.hash);
        } catch (QiniuException ex) {
            Response r = ex.response;
            System.err.println(r.toString());
            try {
                System.err.println(r.bodyString());
            } catch (QiniuException ex2) {
                //ignore
            }
        }
    }

    @Test
    public void test02(){

        QiniuUtils.upload2Qiniu("C:\\Users\\Administrator\\Desktop\\mysql.jpg","mysql");
        System.out.println("上传成功");
    }

    */
/**
     * 删除图片
     *//*

    @Test
    public void test01(){
       //构造一个带指定 Region 对象的配置类
        Configuration cfg = new Configuration(Zone.zone0());
        //其他参数参考类注释
        String accessKey = "_5dEPwssysc_i7y7hnwAn60vHiGDsPyKNgMl_4Fk";
        String secretKey = "X3Xx3Ob-jE3siPjC8YOQWPYLorxuThHO3EYLuJN_";
        String bucket = "yanghuatestdata";
        String key = "mysql";
        Auth auth = Auth.create(accessKey, secretKey);
        BucketManager bucketManager = new BucketManager(auth, cfg);
        try {
            bucketManager.delete(bucket, key);
        } catch (QiniuException ex) {
            //如果遇到异常，说明删除失败
            System.err.println(ex.code());
            System.err.println(ex.response.toString());
        }
    }
}*/
